#include <iostream>
#include <algorithm>
using namespace std;

signed main()
{
    string s;
    getline(cin,s);
    int maxl = 1;
    for(int i=0;i<s.size()&&s.size()-i>=maxl;i++){
        for(int j=maxl;j<=s.size()-i;j++){
            string t1 = s.substr(i,j);
            string t2 = t1;
            reverse(t1.begin(),t1.end());
            if(t1==t2&&t1.size()>maxl){
                maxl = j;
            }
        }
    }
    cout<<maxl;
    return 0;
}
